# -*- coding:utf-8 -*-
# @Project:
# @File:
# @Date:
# @Author:Joe
# @Description:
import requests
import json
import time

"""
    企业微信群机器人
"""


def send_to_wechat(webhook_url, send_message):
    headers = {'Content-Type': 'application/json'}
    data = {
        "msgtype": "markdown",
        "markdown": {
            "content": send_message
        }
    }
    response = requests.post(webhook_url, headers=headers, json=data)
    return response.json()


# 构建消息内容
webhook = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=c019fc66-68b2-4419-b146-6c0f81ca5a4c"
today = time.strftime("%Y-%m-%d", time.localtime())
message = f"私有云 测试报告 {today}\n详情请查看: [Allure Report](http://192.168.10.219:8000)"
# 调用函数发送消息
result = send_to_wechat(webhook, message)
print(result)
